package global



const IterationStagePlan 		string = "plan" 		//版本规划阶段
const IterationStageDevelopment string = "development"  //开发阶段
const IterationStageTest        string = "test"         //测试阶段
const IterationStagePre         string = "pre"          //uat阶段
const IterationStageOnline      string = "online"       //发布上线阶段


func NextStage(stage string) string{
	switch stage {
	case IterationStagePlan:
		return IterationStageDevelopment
	case IterationStageDevelopment:
		return IterationStageTest
	case  IterationStageTest:
		return IterationStagePre
	case IterationStagePre:
		return IterationStageOnline
	default:
		return ""
	}
}

const FlowStatusNotStart 		string = "notStart"		//未开始
const FlowStatusRunning			string = "running"		//进行中
const FlowStatusFailure			string = "failure"		//发布失败
const FlowStatusSuccess			string = "success"		//发布成功
const FlowStatusFinish			string = "finish"		//已完成或已流转

const PubTemplateStatusNotStart 		string = "notStart"		//未开始
const PubTemplateStatusRunning			string = "running"		//进行中
const PubTemplateStatusFailure			string = "failure"		//发布失败
const PubTemplateStatusSuccess			string = "success"		//发布成功
const PubTemplateStatusFinish			string = "finish"		//已完成或已流转


const PipelineStatusNotStart   string  = "notStart"		//未开始
const PipelineStatusRunning    string  = "running"		//进行中
const PipelineStatusFailure    string  = "failure"		//失败
const PipelineStatusSuccess    string  = "success"		//成功



const SqlExecuteStatusNotStart     string = "noStart"       //未开始
const SqlExecuteStatusChecking     string = "checking"      //检测中
const SqlExecuteStatusCheckFailure string = "checkFailure"  //检测失败
const SqlExecuteStatusApprovaling  string = "approvaling"   //审批中
const SqlExecuteStatusApprovalFailure  string = "checkFailure"  //审批不通过
const SqlExecuteStatusRunning      string = "running"      //执行中
const SqlExecuteStatusFailure      string = "failure"      //执行失败
const SqlExecuteStatusSuccess      string = "success"      //执行成功



const (
	ReleaseStatusInit   = iota
	ReleaseStatusPending
	ReleaseStatusRunning
	ReleaseStatusSuccess
	ReleaseStatusFailure
	ReleaseStatusCancel

)


var RELEASE_STATUS = map[string]int{
	"init":     0,
	"pending":  1,
	"running":  2,
	"success":  3,
	"failed":   4,
	"canceled": 5,
	"gray":     6,
}

const (
	ReleaseOperateTypeRelease  = iota
	ReleaseOperateTypeRollback
	ReleaseOperateTypeCanary
)